<template>
	<view class="content">
		<u-navbar fixed title="消息详情" :autoBack="true"></u-navbar>
		<view class="inner-content">
			<view class="info-content">
				<view class="left-content">
					<u-icon name="bell" color="#000" size="24"></u-icon>
				</view>
				<view class="right-content">
					<view>
						<view class="title">
							通知
						</view>
						<view class="info">
							{{ '蓝牙模块已收到，很小巧，跟usb wifi差不多，很精美，淘宝上购物第一次满分体验。插上试了一下，不会出现卡顿。win10是面驱动的，插上就可以直接使用，蓝牙耳机耳麦也可以使用，还有什么东西都可以连接的，实在是太方便的了。非常的满意，还有价格是真的超级便宜。物美价廉。会一直关注的。' }}
						</view>
						<view class="bottom-info">
							<view>通知日期：2025-09-01</view>
							<view>通知人：小黑娃</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		updateMsgStatus,
		getMsgDetail
	} from '@/api/message'
	import moment from 'moment'
	export default {
		data() {
			return {
				data: {
					content: '',
				}
			}
		},
		onLoad(options) {
			// if (options.id) {
			// 	this.getMsgDetail(options.id)
			// }
		},
		methods: {
			//获取消息详情
			getMsgDetail(id) {
				const userId = this.$store.getters?.userInfo?.id
				uni.showLoading({
					title: '加载中...'
				})
				getMsgDetail(userId, id).then(res => {
					this.data = res.data
					console.log(res.data)
					this.updateMsgStatus(id)
				}).finally(() => {
					uni.hideLoading()
				})
			},
			//将消息状态改为已读
			updateMsgStatus(id) {
				const userId = this.$store.getters?.userInfo?.id
				const data = {
					user_id: userId,
					notice_id: id
				}
				updateMsgStatus(data)
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		padding-top: 126rpx;
		padding-bottom: 48rpx;
		background-color: #f3f4f6;

		.inner-content {
			padding: 24rpx;
			font-color: #101010;

			background-color: #fff;
			margin: 24rpx;
			border-radius: 12rpx;

			.info-content {
				display: flex;

				.right-content {
					margin-left: 20rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					width: 100%;

					.title {
						font-size: 28rpx;
						font-color: #101010;
					}

					.info {
						color: #888;
						font-size: 24rpx;
						margin-top: 5px;
					}

					.bottom-info {
						color: #888;
						font-size: 24rpx;
						margin-top: 24rpx;
					}
				}

			}



		}
	}
</style>